using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_ItemOnHandMap : EntityTypeConfiguration<so_ItemOnHand>
    {
        public so_ItemOnHandMap()
        {
            // Primary Key
            this.HasKey(t => new { t.description, t.expiry });

            // Properties
            this.Property(t => t.item)
                .HasMaxLength(10);

            this.Property(t => t.description)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.location)
                .HasMaxLength(3);

            // Table & Column Mappings
            this.ToTable("so_ItemOnHand");
            this.Property(t => t.item).HasColumnName("item");
            this.Property(t => t.description).HasColumnName("description");
            this.Property(t => t.expiry).HasColumnName("expiry");
            this.Property(t => t.location).HasColumnName("location");
            this.Property(t => t.YTD_RCPTS).HasColumnName("YTD_RCPTS");
            this.Property(t => t.qty).HasColumnName("qty");
        }
    }
}
